﻿#include<iostream>
using namespace std;

class Date
{
	// 
	friend void operator<<(ostream& out, const Date& d);
public:
	Date(int year = 1, int month = 1, int day = 1);
	void Print();

	// inline
	int GetMonthDay(int year, int month)
	{
		static int monthDayArray[13] = { -1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

		if (month == 2 && (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0))
		{
			return 29;
		}

		return monthDayArray[month];
	}

	bool operator<(const Date& d);
	bool operator<=(const Date& d);
	bool operator>(const Date& d);
	bool operator>=(const Date& d);
	bool operator==(const Date& d);
	bool operator!=(const Date& d);

	// d1 += 
	Date& operator+=(int day);
	Date operator+(int day);

	// d1 -= 
	Date& operator-=(int day);
	// d1 - 100
	Date operator-(int day);

	// d1 - d2
	int operator-(const Date& d);

	// ++d1 -> d1.operator++();
	Date& operator++();

	// d1++ -> d1.operator++(0);
	Date operator++(int);

	Date& operator--();

	Date operator--(int);

	//void operator<<(ostream& out);

private:
	int _year;
	int _month;
	int _day;
};

void operator<<(ostream& out, const Date& d);